function [cost,qzero,qbase,solq]=welfarecostnash(r,sigma,theta, A)
	u=@(x) 74.1752*x.^(0.6);
	c=@(x) 8.23249 *x.^(1.51678);
	uprime=@(x) 0.6*74.1752*x.^(0.6-1);
	cprime=@(x) 1.51678*8.23249 *x.^(1.51678-1);
	w=@(x) theta*uprime(x)./(theta*uprime(x)+(1-theta)*cprime(x));
	z=@(x) w(x).*c(x)+(1-w(x)).*u(x);
	objq=@(x) -(-r*z(x)+sigma*(u(x)-z(x)));
	solq=fminbnd(objq,0.00001,5);
	objzero=@(x) -(sigma*(u(x)-z(x)));
	qzero=fminbnd(objzero,0.00001,5);
	objbase=@(x) -(-0.03*z(x)+sigma*(u(x)-z(x)));
	qbase=fminbnd(objbase,0.00001,5);
	fun= @(delta) sigma*(u(qbase*(1-delta))-c(qbase))-A*delta-sigma*(u(solq)-c(solq));
	cost=fzero(fun,0.01);
end

